<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>main</title>
    <link rel="stylesheet" th:href="@{/static/layui/css/layui.css}">
    <style>
        .layadmin-iframe {
            position: absolute;
            width: 100%;
            height: 100%;
            left: 0;
            top: 0;
            right: 0;
            bottom: 0;
            background-color: #f2f2f2;
        }
        .layui-fluid {
            padding: 10px;
            background-color: white;
            margin: 10px;
        }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">员工管理系统</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:" th:text="'欢迎您，'+${session.userName}">
                    <img th:src="@{/static/img/head.jpg}" class="layui-nav-img">

                </a>
            </li>
            <li class="layui-nav-item"><a th:href="www.baidu.com">退出</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a data_herf="./templates/allEmployee.html" href="javascript:">员工查看</a>
                </li>
                <li class="layui-nav-item">
                    <a data_herf="./templates/main.html" href="javascript:">薪酬管理</a>
                </li>
                <li class="layui-nav-item">
                    <a data_herf="./templates/main.html" href="javascript:">考勤查看</a>
                </li>
                <li class="layui-nav-item">
                    <a>人事调动</a>
                </li>
            </ul>
        </div>
    </div>
    <div class="layui-body">
        <!-- 内容主体区域 -->
        <iframe class="layadmin-iframe" id="Z_iframe" th:src="@{/allEmployee}" ></iframe>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © zhou.com
    </div>
</div>
<script th:src="@{/static/layui/layui.js}"></script>
<script>
    //JavaScript代码区域
    layui.use('element', function () {
        const element = layui.element;
        const Z_iframe = document.getElementById("Z_iframe");
        element.on('nav(test)', function (data) {
            console.log(data[0].attributes[0].nodeValue)
            Z_iframe.src = data[0].attributes[0].nodeValue

        });


    });
</script>
</body>
</html>